/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package test3d.nehe;

import test3d.Test3D;
import xenon3d.Canvas3D;
import xenon3d.View3D;
import xenon3d.Xenon3D;

/**
 * NeHe Tutorial 01: "Setting Up An OpenGL Window".<p>
 * New Features: Xenon3D, Canvas3D, View3D objects
 */
public class NeHe01 implements Test3D {
    
    // <editor-fold defaultstate="collapsed" desc=" Constant Attributes ">
    
    /** The test title. */
    private static final String TITLE = "Setting Up An OpenGL Window";
    
    /** The test id. */
    private static final String ID = "01";
    
    /** The package screen name. */
    private static final String PACKAGE = "NeHe";
    
    /** The window caption. */
    private static final String CAPTION = PACKAGE + " " + ID + " - " + TITLE;
    
    // </editor-fold>
    
    // <editor-fold defaultstate="collapsed" desc=" Private Fields ">
    
    /** The Xenon3D master window. */
    private Xenon3D xenon;
    
    /** The Canvas3D to render the scene into. */
    private Canvas3D canvas;
    
    /** The View3D which defines the view to the scene. */
    private View3D view;
    
    // </editor-fold>
    
    // <editor-fold defaultstate="collapsed" desc=" Initialization ">
    
    /**
     * Creates a new NeHe01 example object.
     */
    public NeHe01() {
        xenon = new Xenon3D(CAPTION);
        view = new View3D();
        view.setViewModePolicy(View3D.ViewModePolicy.Trace);
        canvas = createCanvas3D();
        canvas.attachView(view);
        xenon.attachCanvas(canvas);
    }
    
    /**
     * Starts the NeHe01 example program.
     * @param args  the param array
     */
    public static void main(String[] args) {
        NeHe01 app = new NeHe01();
    }
    
    // </editor-fold>
    
    // <editor-fold defaultstate="collapsed" desc=" Implemtation Test3D ">
    
    @Override
    public String getTitle() {
        return TITLE;
    }
    
    /**
     * Returns the test package screen name.
     * @return the package screen name
     */
    public String getPackageName() {
        return PACKAGE;
    }
    
    /**
     * Returns the test id.
     * @return the test id
     */
    public String getId() {
        return ID;
    }
    
    // </editor-fold>
    
    // <editor-fold defaultstate="collapsed" desc=" Local Canvas3D Class ">
    
    /**
     * Returns a new customized Canvas3D object.
     * @return the new Canvas3D
     */
    private Canvas3D createCanvas3D() {
        return new Canvas3D() {
            
            @Override
            public void init() {
                System.out.println("Canvas3D.init()");
            }
            
            @Override
            public void reshape(int width, int height) {
                System.out.println("Canvas3D.reshape(" + width + ", " + height + ")");
            }
            
            @Override
            public void preRender() {
                System.out.println("Canvas3D.preRender()");
            }
            
            @Override
            public void render() {
                System.out.println("Canvas3D.render()");
            }
            
            @Override
            public void postRender() {
                System.out.println("Canvas3D.postRender()");
            }
            
            @Override
            public void dispose() {
                System.out.println("Canvas3D.dispose()");
            }
            
        };
    }
    
    // </editor-fold>

} // end class NeHe01